import { defineStore } from "pinia";

export const useGlobalStore = defineStore("global", {
  state: () => ({
    title: <string>"伏羲東方数字化智慧云平台",
    subTitle:[],
  }),
  getters: {
    getTitle(state: any) {
      return state.title;
    },
  },
  actions: {
    setTile(newNTitle: string) {
      this.title = newNTitle;
    },
    setSubTitle(newNsubTitle: string) {
      this.subTitle.push(newNsubTitle);
    },
    deleteSubTitle() {
      // 删除最后一个子标题
      this.subTitle.pop();
    },
    clearSubTitle() {
      this.subTitle = [];
    },
  },
});
